﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true"
    CodeBehind="LottoSettingInfo.aspx.cs" Inherits="LotteryVote.LottoSettingInfo" %>

<%@ Register Src="~/Controls/MemberCommissionInfo.ascx" TagPrefix="LV" TagName="MemberCommission" %>
<%@ Register Src="~/Controls/AgentCommissionInfo.ascx" TagPrefix="LV" TagName="AgentCommission" %>
<%@ Import Namespace="LotteryVote.Entity" %>
<%@ Import Namespace="LotteryVote.Utility" %>
<asp:Content ID="Header" ContentPlaceHolderID="head" runat="server">
    <link href="Style/Commission.css" rel="stylesheet" type="text/css" />
</asp:Content>
<asp:Content ID="Main" ContentPlaceHolderID="main" runat="server">
    <asp:PlaceHolder ID="pl_comm" runat="server"></asp:PlaceHolder>
    <h3>
        <%=GetGlobalResourceObject("Resource", "BetLimit")%></h3>
    <table cellpadding="0" cellspacing="0">
        <thead>
            <tr>
                <%foreach (var gameType in EnumHelper.GetDescription<GameTypeEnum>())
                  { %>
                <td colspan="2">
                    <%=gameType.Description%>
                </td>
                <%} %>
            </tr>
            <tr>
                <%for (int i = 0; i < EnumHelper.GetDescription<GameTypeEnum>().Count; i++)
                  { %>
                <td>
                    <%=GetGlobalResourceObject("Resource", "Min")%>
                </td>
                <td>
                    <%=GetGlobalResourceObject("Resource", "Max")%>
                </td>
                <%} %>
            </tr>
        </thead>
        <tr>
            <%foreach (var gameType in EnumHelper.GetDescription<GameTypeEnum>())
              {
                  var limit = FindBetLimit(gameType.Value); %>
            <td>
                <%=limit.LeastLimit%>
            </td>
            <td>
                <%=limit.LargestLimit %>
            </td>
            <%} %>
        </tr>
    </table>
    <h3>
        <%=GetGlobalResourceObject("Resource", "GameLimit")%></h3>
    <table cellpadding="0" cellspacing="0">
        <thead>
            <tr>
                <td rowspan="2">
                    <%=GetGlobalResourceObject("Resource", "CompanyType")%>
                </td>
                <td colspan="4">
                    2D
                </td>
                <td colspan="4">
                    3D
                </td>
                <td colspan="2">
                    4D
                </td>
                <td rowspan="2">
                    PL2
                </td>
                <td rowspan="2">
                    PL3
                </td>
            </tr>
            <tr>
                <td>
                    <%=GetGlobalResourceObject("Resource", "Head")%>
                </td>
                <td>
                    <%=GetGlobalResourceObject("Resource", "Last")%>
                </td>
                <td>
                   <%=GetGlobalResourceObject("Resource", "Roll")%>
                </td>
                <td>
                    <%=GetGlobalResourceObject("Resource", "Roll7")%>
                </td>
                <td>
                    <%=GetGlobalResourceObject("Resource", "Head")%>
                </td>
                <td>
                    <%=GetGlobalResourceObject("Resource", "Last")%>
                </td>
                <td>
                   <%=GetGlobalResourceObject("Resource", "Roll")%>
                </td>
                <td>
                   <%=GetGlobalResourceObject("Resource", "Roll7")%>
                </td>
                <td>
                    <%=GetGlobalResourceObject("Resource", "Last")%>
                </td>
                <td>
                    <%=GetGlobalResourceObject("Resource", "Roll")%>
                </td>
            </tr>
        </thead>
        <%foreach (var companyTypeDesc in EnumHelper.GetDescription<CompanyType>())
          { %>
        <tr>
            <td>
                <%=companyTypeDesc.Description%>
            </td>
            <td>
                <%var gamePlayWayId = FindGamePlayWay((int)GameTypeEnum.TwoDigital, (int)PlayWayEnum.Head).Id;
                  var limit = FindGameLimit(companyTypeDesc.Value, gamePlayWayId).LimitValue;
                %>
                <%=limit %>
            </td>
            <td>
                <% gamePlayWayId = FindGamePlayWay((int)GameTypeEnum.TwoDigital, (int)PlayWayEnum.Last).Id;
                   limit = FindGameLimit(companyTypeDesc.Value, gamePlayWayId).LimitValue;
                %>
                <%=limit %>
            </td>
            <td>
                <% gamePlayWayId = FindGamePlayWay((int)GameTypeEnum.TwoDigital, (int)PlayWayEnum.Roll).Id;
                   limit = FindGameLimit(companyTypeDesc.Value, gamePlayWayId).LimitValue;
                %>
                <%=limit %>
            </td>
            <td>
                <% gamePlayWayId = FindGamePlayWay((int)GameTypeEnum.TwoDigital, (int)PlayWayEnum.Roll7).Id;
                   var betlimit = FindGameLimit(companyTypeDesc.Value, gamePlayWayId);
                   if (betlimit != null)
                   {
                       limit = betlimit.LimitValue;
                %>
                <%=limit %>
                <%} %>
            </td>
            <td>
                <% gamePlayWayId = FindGamePlayWay((int)GameTypeEnum.ThreeDigital, (int)PlayWayEnum.Head).Id;
                   limit = FindGameLimit(companyTypeDesc.Value, gamePlayWayId).LimitValue;
                %>
                <%=limit %>
            </td>
            <td>
                <% gamePlayWayId = FindGamePlayWay((int)GameTypeEnum.ThreeDigital, (int)PlayWayEnum.Last).Id;
                   limit = FindGameLimit(companyTypeDesc.Value, gamePlayWayId).LimitValue;
                %>
                <%=limit %>
            </td>
            <td>
                <% gamePlayWayId = FindGamePlayWay((int)GameTypeEnum.ThreeDigital, (int)PlayWayEnum.Roll).Id;
                   limit = FindGameLimit(companyTypeDesc.Value, gamePlayWayId).LimitValue;
                %>
                <%=limit %>
            </td>
            <td>
                <% gamePlayWayId = FindGamePlayWay((int)GameTypeEnum.ThreeDigital, (int)PlayWayEnum.Roll7).Id;
                   betlimit = FindGameLimit(companyTypeDesc.Value, gamePlayWayId);
                   if (betlimit != null)
                   {
                       limit = betlimit.LimitValue;
                %>
                <%=limit %>
                <%} %>
            </td>
            <td>
                <% gamePlayWayId = FindGamePlayWay((int)GameTypeEnum.FourDigital, (int)PlayWayEnum.Last).Id;
                   limit = FindGameLimit(companyTypeDesc.Value, gamePlayWayId).LimitValue;
                %>
                <%=limit %>
            </td>
            <td>
                <% gamePlayWayId = FindGamePlayWay((int)GameTypeEnum.FourDigital, (int)PlayWayEnum.Roll).Id;
                   limit = FindGameLimit(companyTypeDesc.Value, gamePlayWayId).LimitValue;
                %>
                <%=limit %>
            </td>
            <td>
                <% gamePlayWayId = FindGamePlayWay((int)GameTypeEnum.PL2, 0).Id;
                   limit = FindGameLimit(companyTypeDesc.Value, gamePlayWayId).LimitValue;
                %>
                <%=limit %>
            </td>
            <td>
                <% gamePlayWayId = FindGamePlayWay((int)GameTypeEnum.PL3, 0).Id;
                   limit = FindGameLimit(companyTypeDesc.Value, gamePlayWayId).LimitValue;
                %>
                <%=limit %>
            </td>
        </tr>
        <%} %>
    </table>
</asp:Content>
